<?php
	require_once dirname(__FILE__) . '/../../utils/Utils.php';
	//引入公共参数
	$constant = include(dirname(__FILE__) . '/../../AppletConstant.php');

	$utils =	new Utils();

	/**
	 *  更新小程序会员卡
	 *
	 */

	//调用地址
	$url = "https://open.95516.com/open/access/1.0/updateMemberCard";
	//拼装参数Map
	$params 	=	array();
	$params["appId"] 				=	$constant['appId'];
	$params["openId"] = $constant['openId'];

	//会员卡模板id
	$params["cardTemplateId"] = "";

	//会员卡code
	$params["upMemberCardNo"] = "";

	//会员卡编号
	$params["merchantMemberCardNo"] = "";

	//会员卡背景图
	$params["backgroundPictureUrl"] = "";

	//更新前用户储值余额
	$params["balanceBefore"] = "";

	//更新后用户储值余额
	$params["balance"] = "";

	//本次余额变动值
	$params["balanceAdd"] = "";

	//储值消耗记录
	$params["balanceRemark"] = "";

	//变更前的会员积分值
	$params["bonusBefore"] = "";

	//现会员积分值
	$params["bonus"] = "";

	//积分变动值
	$params["bonusAdd"] = "";

	//会员等级
	$params["level"] = "";

	//随机字符串
	$nonceStr = $utils->createNonceStr();
	$params["nonceStr"] =	$nonceStr;

	//时间戳
	$timestamp = time();
	$params["timestamp"] =	$timestamp;

	//签名
	$signature = $utils->sign($params, $constant['SIGN_KEY_PACKET']);
    $params["signature"]=$signature;

	//对称密钥加密
	$params = $utils->encryptedParamMap($constant['SYMMETRIC_KEY'], $params, array("upMemberCardNo", "merchantMemberCardNo", "balanceBefore","balance","balanceAdd","bonusBefore","bonus","bonusAdd"));

	//发送请求
	$resultStr 	=	$utils->sendPostGson($url,$params);
	print_r("-------获取更新小程序会员卡信息: ".$resultStr." --------- ");
    exit();
	
?>
